<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script type="text/javascript">
       function getValue() {
         //根据Id查询到select元素
         var x = document.getElementById("ss");
         alert(x.selectedIndex);
       }
    </script>
</head>
<body>
  <select id="ss" onchange="getValue()">
    <option value="1">Java</option>
    <option value="2">C++</option>
    <option value="3" selected>Node</option>
    <option value="4">Spring</option>
  </select>
</body>
</html>